package com.abner.activiti;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.runtime.ProcessInstance;

/**
 * @description: 启动一个流程实例 前提定义好一个流程实例
 * @author: guoc
 * @createDate: 2020/9/9 17:51
 */
public class activitiStart {

    /**
     * 启动一个流程实例
     *  act_hi_procinst         流程实例
     *  act_hi_identitylink     参与者信息
     *  act_hi_actinst          已经完成活动
     *  act_hi_taskinst         任务实例
     *  act_ru_execution        执行者
     *  act_ru_identitylink     参与者信息
     *  act_ru_task     任务表
     * @return void
     * @author guoc
     * @date 2020/9/9 17:52
     */
    public static void main(String[] args) {
        //获取ProcessEngine
        ProcessEngine defaultProcessEngine = ProcessEngines.getDefaultProcessEngine();
        // 获取RunTimeService
        RuntimeService runtimeService = defaultProcessEngine.getRuntimeService();

        // 根据流程定义key启动流程 需要知道key  //holiday  startProcessInstanceByKey  act_re_procdef
        ProcessInstance holiday = runtimeService.startProcessInstanceByKey("game");

        System.out.println("流程部署ID"+holiday.getDeploymentId()); //流程部署IDnull
        System.out.println("实例ID"+holiday.getId()); //实例ID2501
        System.out.println("活动ID"+holiday.getActivityId()); //活动IDnull
    }

}
